<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>机构管理</title>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function (form) {
					cancelSelect();
					form.submit();
				},
				errorClass: 'validation-invalid-label',
				highlight: function(element, errorClass) {
					$(element).removeClass(errorClass);
				},
				errorPlacement: function (error, element) {
					validateErrorPlacement(error, element);
				}
			});
		});
	</script>
</head>
<body>
<div class="content">
	<div class="card">
		<div class="card-body">
			<form:form id="inputForm" method="post"  target="officeFrame"
					   modelAttribute="office" action="${ctxAdmin}/sys/office/save" >
				<form:hidden path="id"/>
				<form:hidden path="useable" value="1"/>
				<form:hidden path="area.id" value="2"/>
				<sys:message content="${message}"/>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">上级机构</label>
					<div class="col-sm-8">
						<sys:treeselect id="office" name="parent.id" value="${office.parent.id}" labelName="parent.name" labelValue="${office.parent.name}"
							title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="" allowClear="${office.currentUser.admin}"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">机构名称</label>
					<div class="col-sm-8">
						<form:input path="name" htmlEscape="false" maxlength="50"  cssClass="required form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">机构编码</label>
					<div class="col-sm-8">
						<form:input path="code" htmlEscape="false" maxlength="50"  cssClass="required form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">机构类型</label>
					<div class="col-sm-8">
						<form:select path="type" class="input-medium">
							<form:options items="${fns:getDictList('sys_office_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">机构级别</label>
					<div class="col-sm-8">
						<form:select path="grade" class="input-medium">
							<form:options items="${fns:getDictList('sys_office_grade')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">电话</label>
					<div class="col-sm-8">
						<form:input path="phone" htmlEscape="false" maxlength="50" cssClass="form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">传真</label>
					<div class="col-sm-8">
						<form:input path="fax" htmlEscape="false" maxlength="50" cssClass="form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">联系地址</label>
					<div class="col-sm-8">
						<form:input path="address" htmlEscape="false" maxlength="50" cssClass="form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-3 col-form-label">邮政编码</label>
					<div class="col-sm-8">
						<form:input path="zipCode" htmlEscape="false" maxlength="50" cssClass="form-control"/>
					</div>
				</div>
				<div class="form-group row">
					<div class="col-sm-9 ml-auto">
						<shiro:hasPermission name="sys:dict:edit">
							<button type="submit" class="btn btn-primary"><i class="icon-database-check mr-2"></i>保 存</button>
						</shiro:hasPermission>
						<button type="button" class="btn btn-light" onclick="cancelSelect()" ><i class="icon-database-arrow mr-2"></i>取 消</button>
					</div>
				</div>
			</form:form>
		</div>
	</div>
</div>
</body>
</html>